package day06_OOP.demo08;
//String类的其它功能:
//替换功能:
//String replace(char old,char new)
//String replace(String old,String new)
//去除字符串两端空格
//String trim()
//按字典顺序比较两个字符串
//int compareTo(String str)
//int compareTognoreCase(String str)
public class String的其它用法 {
    public static void main(String[] args) {
        String a1="helloWorld";
        String a2=a1.replace('e','k');//替换功能:
        String a3=a1.replace("owo","aka");
        System.out.println("a1="+a1);
        System.out.println("a2="+a2);
        System.out.println("a3="+a3);

        String a4="   hello   World     ";
        String a5=a4.trim();
        System.out.println(a5);//去除字符串两端空格

        String a6="hello";
        String a7="hello";
        String a8="abc";
        String a9="xyz";
        System.out.println(a6.compareTo(a7));//0
        System.out.println(a6.compareTo(a8));//7
        System.out.println(a6.compareTo(a9));//-16
    }
}
